﻿using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BaGiaDanhCuop
{
    class Sprite
    {
        public Vector2 Position;
        public Texture2D Texture;

        public Sprite(Vector2 Position, Texture2D texture)
        {
            this.Texture = texture;
            this.Position = Position;
        }
        public void Draw(SpriteBatch Batch, SpriteEffects Effects)
        {
            Draw(Batch, 1.0f, Effects);
        }

        public void Update(float x, float y) {
            Position = new Vector2(x, y);
        }

        public void Draw(SpriteBatch spriteBatch, float scale, SpriteEffects spriteEffect)
        {
            spriteBatch.Draw
                    (Texture, Position, new Rectangle(0, 0, Texture.Bounds.Width, Texture.Bounds.Height),
                  Color.White, 0f, Vector2.Zero, scale, spriteEffect, 0);
        }

        public Boolean contain(double x, double y)
        {
            return x >= Position.X && x <= Position.X + Texture.Width && y >= Position.Y && y <= Position.Y + Texture.Height;
        }

        public double getWidth() {
            return Texture.Width;
        }

        public double getHeight() {
            return Texture.Height;
        }
    }
}
